hysop.backend.host.python.operator.penalization module¶
- class hysop.backend.host.python.operator.penalization.CommonPenalization(**kwds)[source]¶
Bases:
object
- class hysop.backend.host.python.operator.penalization.PythonPenalizeVelocity(obstacles, variables, velocity, dt, coeff=None, ubar=None, formulation=None, **kwds)[source]¶
Bases:
HostOperator
,CommonPenalization
Create the common attributes of all host operators.
All input and output variable topologies should be of kind Backend.HOST and share the same HostEnvironment.
- apply(**kwds)¶
Abstract method that should be implemented. Applies this node (operator, computational graph operator…).
- classmethod available_methods()[source]¶
Returns the available methods of this node. This should return a dictionary of method as keys and possible values as a scalar or an iterable. See hysop.types.InstanceOf to support specific class types. This is used to check user method input.
- classmethod default_method()[source]¶
Returns the default method of this node. Default methods should be compatible with available_methods. If the user provided method dictionnaty misses some method keys, a default value for this key will be extracted from the default one.
- discretize()[source]¶
By default, an operator discretize all its variables. For each input continuous field that is also an output field, input topology may be different from the output topology.
After this call, one can access self.input_discrete_fields and self.output_discrete_fields, which contains input and output dicretised fields mapped by continuous fields.
self.discrete_fields will be a tuple containing all input and output discrete fields.
Discrete tensor fields are built back from discretized scalar fields and are accessible from self.input_tensor_fields, self.output_tensor_fields and self.discrete_tensor_fields like their scalar counterpart.
- get_work_properties()[source]¶
Returns extra memory requirements of this operator. This allows operators to request for temporary buffers that will be shared between operators in a graph to reduce the memory footprint and the number of allocations.
Returned memory is only usable during operator call (ie. in self.apply). Temporary buffers may be shared between different operators as determined by the graph builder.
By default if there is no input nor output temprary fields, this returns no requests, meanning that this node requires no extra buffers.
If temporary fields are present, their memory request are automatically computed and returned.
- setup(work)[source]¶
Setup temporary buffer that have been requested in get_work_properties(). This function may be used to execute post allocation routines. This sets self.ready flag to True. Once this flag is set one may call ComputationalGraphNode.apply() and ComputationalGraphNode.finalize().
Automatically honour temporary field memory requests.
- class hysop.backend.host.python.operator.penalization.PythonPenalizeVorticity(obstacles, variables, velocity, vorticity, dt, coeff=None, ubar=None, formulation=None, **kwds)[source]¶
Bases:
HostOperator
,CommonPenalization
Create the common attributes of all host operators.
All input and output variable topologies should be of kind Backend.HOST and share the same HostEnvironment.
- apply(**kwds)¶
Abstract method that should be implemented. Applies this node (operator, computational graph operator…).
- classmethod available_methods()[source]¶
Returns the available methods of this node. This should return a dictionary of method as keys and possible values as a scalar or an iterable. See hysop.types.InstanceOf to support specific class types. This is used to check user method input.
- classmethod default_method()[source]¶
Returns the default method of this node. Default methods should be compatible with available_methods. If the user provided method dictionnaty misses some method keys, a default value for this key will be extracted from the default one.
- discretize()[source]¶
By default, an operator discretize all its variables. For each input continuous field that is also an output field, input topology may be different from the output topology.
After this call, one can access self.input_discrete_fields and self.output_discrete_fields, which contains input and output dicretised fields mapped by continuous fields.
self.discrete_fields will be a tuple containing all input and output discrete fields.
Discrete tensor fields are built back from discretized scalar fields and are accessible from self.input_tensor_fields, self.output_tensor_fields and self.discrete_tensor_fields like their scalar counterpart.
- get_field_requirements()[source]¶
Called just after handle_method(), ie self.method has been set. Field requirements are:
required local and global transposition state, if any.
required memory ordering (either C or Fortran)
Default is Backend.HOST, no min or max ghosts, MemoryOrdering.ANY and no specific default transposition state for each input and output variables.
- get_work_properties()[source]¶
Returns extra memory requirements of this operator. This allows operators to request for temporary buffers that will be shared between operators in a graph to reduce the memory footprint and the number of allocations.
Returned memory is only usable during operator call (ie. in self.apply). Temporary buffers may be shared between different operators as determined by the graph builder.
By default if there is no input nor output temprary fields, this returns no requests, meanning that this node requires no extra buffers.
If temporary fields are present, their memory request are automatically computed and returned.
- handle_method(method)[source]¶
Method automatically called during initialization. This allow to extract method values after method preprocessing. Method preprocessing means:
complete user input with compatible top graph user inputs
complete the resulting dictionnary with the node default_method
check method against available_methods.
The result of this process is fed as argument of this function.
- setup(work)[source]¶
Setup temporary buffer that have been requested in get_work_properties(). This function may be used to execute post allocation routines. This sets self.ready flag to True. Once this flag is set one may call ComputationalGraphNode.apply() and ComputationalGraphNode.finalize().
Automatically honour temporary field memory requests.